package org.jeecg.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * online 拦截器配置
 */
@Configuration("onlineConfiguration")
public class OnlineConfiguration implements WebMvcConfigurer {

    @Bean
    public OnlineInterceptor onlineInterceptor(){
        return new OnlineInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String [] exculudes = new String[]{"/*.html","/html/**","/js/**","/css/**","/images/**"};
        registry.addInterceptor(onlineInterceptor()).excludePathPatterns(exculudes).addPathPatterns("/online/cgform/api/**");
    }
}
